package appconfig

import "github.com/spf13/viper"

type Conf struct {
	Mysql struct {
		Host     string
		Port     string
		User     string
		Password string
		Database string
	}
	Redis struct {
		Host     string
		Port     string
		Password string
		Database int
	}
}

var Config Conf

func Init() {
	viper.SetConfigFile("src/work/appconfig/dev.yaml")
	err := viper.ReadInConfig()
	if err != nil {
		panic("读取失败")
	}
	err = viper.Unmarshal(&Config)
	if err != nil {
		panic("解析失败")
	}
}
